#pragma once
#include <string>


namespace soft_renderer
{
	class ParserBuffer
	{
	private:
		char* BUFFER;
		int CONTENT_SIZE;
		int index;

	public:
		ParserBuffer(char* buffer, int content_length);
		~ParserBuffer();

		void PreProcessSTLData();

		// 跳过一行
		void SkipLine();
		// 跳过单词
		void SkipWord();
		void ReadWord(const char* word, bool ignoreLeadingSpace = true);
		void SkipWS();
		std::string ReadNext(int len);
		std::string ReadLine();
		void ReadLine(char* buf, const int MAX_SIZE);
		void Back(int step = 1);
		char GetChar();
		void CheckEOF();
		double ReadDouble();
		char PeekChar();
		bool ReachSTLEnd();

		bool PatternCheck(const char* pattern, int len);
	};
}


